/*
-------------------------------------------------

	Singleton.h

	Dmitriy Kuzmenko (Dgut)

-------------------------------------------------
*/

#ifndef __AUTUMN_SINGLETON_H__
#define __AUTUMN_SINGLETON_H__

namespace Autumn
{

template< class T >
class Singleton
{
	static T			instance;
protected:
//						Singleton( void );
//	virtual				~Singleton( void );
public:
	inline static T &	GetInstance( void );
//	static void			ClearInstance( void );
};

template< class T >
T Singleton< T >::instance;

/*template< class T >
 CSingleton< T >::CSingleton( void )
 {
 if( !m_pClass )
 m_pClass = static_cast< T * >( this );
 }*/

template< class T >
inline T & Singleton< T >::GetInstance( void )
{
/*	if( !pClass )
		pClass = new T();
*/	
	return instance;
}

/*template< class T >
void Singleton< T >::ClearInstance( void )
{
	delete pClass;
	pClass = 0;
}*/

}	// namespace Autumn

#endif	// !!! __AUTUMN_SINGLETON_H__ !!!